<?php


namespace App\Http\Controller;

use App\Model\Logic\PostEsLogic;
use App\Model\Logic\PostsLogic;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Bean\Annotation\Mapping\Inject;
use Swoft\Console\Helper\Show;
use Swoft\Http\Message\Request;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;

/**
 * @Bean()
 * @Controller("posts")
 * Class PostsController
 * @package App\Http\Controller
 */
class PostsController extends BaseController
{

    /**
     * @Inject()
     * @var PostsLogic
     */
    private $posts_logic;

    /**
     * @RequestMapping("lists")
     */
    public function getList(Request $request)
    {
        $page = $request->get('page', 1);
        $type = $request->get('type', 'post');
        Show::info(time());
        $result = $this->posts_logic->getLists($type, $page, 10, null);
        return $this->response(10000, $result);
    }

}